Skip to content

ci: set up Spotless linting in CI (#351)#366

Merged
edeandrea merged 4 commits intodocling-project:mainfrom
KaleabArgaw:ci/351-code-linting
Mar 2, 2026
Merged

ci: set up Spotless linting in CI (#351)#366
edeandrea merged 4 commits intodocling-project:mainfrom
KaleabArgaw:ci/351-code-linting

Conversation

@KaleabArgaw
Copy link
Contributor

@KaleabArgaw KaleabArgaw commented Feb 25, 2026

Fixes #351

@edeandrea
Copy link
Contributor

Thanks @KaleabArgaw for this! I'll give it a look through later today or tomorrow!

I am going to have copilot do an automated review of it too, but please don't take any actions yet based on what it says. I'm really just testing it out to see if I trust it or not :)

@edeandrea
Copy link
Contributor

@all-contributors add @KaleabArgaw for code documentation

@allcontributors
Copy link
Contributor

@edeandrea

I've put up a pull request to add @KaleabArgaw! 🎉

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates Spotless code linting into the CI pipeline to enforce consistent code formatting across the Java codebase. The implementation uses an incremental rollout strategy via ratchetFrom("origin/main"), which checks only files changed from the main branch. This allows for gradual adoption without requiring all existing code to be reformatted immediately.

Changes:

  • Adds Spotless Gradle plugin (version 7.2.1) to the project dependencies
  • Configures Spotless in the shared Java convention plugin with basic formatting rules (remove unused imports, format annotations, trim trailing whitespace, end with newline)
  • Adds a new lint CI job that runs Spotless formatting checks on all pull requests
  • Updates CONTRIBUTING.md with instructions for running Spotless locally

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
gradle/libs.versions.toml Adds Spotless version (7.2.1) and plugin dependency declaration to the version catalog
buildSrc/build.gradle.kts Adds Spotless Gradle plugin as a buildSrc dependency, making it available to convention plugins
buildSrc/src/main/kotlin/docling-java-shared.gradle.kts Applies Spotless plugin and configures it with ratchetFrom strategy and basic Java formatting rules
.github/workflows/build.yml Adds new lint job that checks out code with full history (fetch-depth: 0), runs spotlessApply, and verifies no formatting changes are needed
CONTRIBUTING.md Documents new Spotless commands (spotlessCheck and spotlessApply) for contributors

@github-actions
Copy link

:java_duke: JaCoCo coverage report

Overall Project 46.08% 🔴

There is no coverage information present for the Files changed

@github-actions
Copy link

github-actions bot commented Feb 25, 2026

TestsPassed ✅SkippedFailed
Gradle Test Results (all modules & JDKs)936 ran936 passed0 skipped0 failed
TestResult
No test annotations available

@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

Copy link
Contributor

@edeandrea edeandrea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments in-line.

I'd also like @ThomasVitale to take a look.

@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@KaleabArgaw KaleabArgaw force-pushed the ci/351-code-linting branch 2 times, most recently from feb364e to ad6b1db Compare February 26, 2026 15:05
@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@edeandrea
Copy link
Contributor

Hi @KaleabArgaw thank you so much for this!

I've just downloaded & built this PR locally and purposefully introduced some things that should break the spotless check. When I run ./gradlew --no-daemon --console=plain spotlessCheck it doesn't seem to find any violations, even though I have introduced clear violations against things inside .editorconfig.

╰─ ./gradlew --no-daemon --console=plain clean spotlessCheck                   
To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/9.3.1/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build 
> Task :buildSrc:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :buildSrc:generateExternalPluginSpecBuilders UP-TO-DATE
> Task :buildSrc:extractPrecompiledScriptPluginPlugins UP-TO-DATE
> Task :buildSrc:compilePluginsBlocks UP-TO-DATE
> Task :buildSrc:generatePrecompiledScriptPluginAccessors UP-TO-DATE
> Task :buildSrc:generateScriptPluginAdapters UP-TO-DATE
> Task :buildSrc:compileKotlin UP-TO-DATE
> Task :buildSrc:compileJava NO-SOURCE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:pluginDescriptors UP-TO-DATE
> Task :buildSrc:processResources UP-TO-DATE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:jar UP-TO-DATE
> Task :docling-core:clean
> Task :docling-serve-api:clean
> Task :docling-serve-client:clean
> Task :docling-testcontainers:clean
> Task :docling-version-tests:clean
> Task :docs:clean UP-TO-DATE
> Task :test-report-aggregation:clean UP-TO-DATE
> Task :spotlessInternalRegisterDependencies UP-TO-DATE
> Task :docling-core:spotlessJava
> Task :docling-core:spotlessJavaCheck
> Task :docling-core:spotlessCheck
> Task :docling-serve-api:spotlessJava
> Task :docling-serve-api:spotlessJavaCheck
> Task :docling-serve-api:spotlessCheck
> Task :docling-serve-client:spotlessJava
> Task :docling-serve-client:spotlessJavaCheck
> Task :docling-serve-client:spotlessCheck
> Task :docling-testcontainers:spotlessJava
> Task :docling-testcontainers:spotlessJavaCheck
> Task :docling-testcontainers:spotlessCheck
> Task :docling-version-tests:spotlessJava
> Task :docling-version-tests:spotlessJavaCheck
> Task :docling-version-tests:spotlessCheck

)

Signed-off-by: Kaleab Argaw <kaleruha16@gmail.com>
@KaleabArgaw
Copy link
Contributor Author

Hey @edeandrea i removed the on build fail that's why you can check now locally.

@github-actions
Copy link

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@edeandrea
Copy link
Contributor

Hi @KaleabArgaw thank you so much for this!

I've thought about this PR a lot over the weekend. I think what I'm going to do for now is merge it, but only with the import order turned on.

I think I as the maintainer need to come up with "What are the coding standards?" :)

So if you don't mind, I may push one or 2 "cleanup" commits to your work and then merge it.

@KaleabArgaw
Copy link
Contributor Author

Hey @edeandrea no problem and thanks for the opportunity.

edeandrea and others added 2 commits March 2, 2026 10:51
…formatting rules

- Introduced `.spotless/import-order.txt` for defining import order.
- Updated Spotless configuration in `docling-java-shared.gradle.kts` to enforce import order.
- Removed conflicting formatting rules from `.editorconfig`.

Signed-off-by: Eric Deandrea <eric.deandrea@gmail.com>
@edeandrea edeandrea enabled auto-merge (squash) March 2, 2026 15:57
@edeandrea edeandrea disabled auto-merge March 2, 2026 15:57
@edeandrea edeandrea enabled auto-merge (squash) March 2, 2026 15:57
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

…t history

Signed-off-by: Eric Deandrea <eric.deandrea@gmail.com>
@edeandrea edeandrea merged commit ad9bc48 into docling-project:main Mar 2, 2026
21 checks passed
@edeandrea
Copy link
Contributor

@all-contributors add @KaleabArgaw for code

@allcontributors
Copy link
Contributor

@edeandrea

@KaleabArgaw already contributed before to code

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

HTML test reports are available as workflow artifacts (zipped HTML).

• Download: Artifacts for this run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set up code linting as part of DevOps processes

3 participants